local awful = require("awful")
require("main.vars")

function get_wallpaper()
    local screen = io.popen("xrandr | grep '" .. extScr .. " connected'"):read("*all")

    currLock     = io.popen("cat "..cfgPath.."wallpaper/lock_ | head -2 | tail -1"):read("*all")
    currLockLong = io.popen("cat "..cfgPath.."wallpaper/lock_ | head -3 | tail -1"):read("*all")
    currLockUp   = io.popen("cat "..cfgPath.."wallpaper/lock_ | head -4 | tail -1"):read("*all")

    if (screen == nil) then return currLock
    else return currLockLong
    end
end

function lock_screen()
   awful.spawn("i3lock -fi " .. get_wallpaper())
end

function lock_suspend()
   --   io.popen("i3lock -fi " .. get_wallpaper() .. " | loginctl suspend"):read("*all")
    cmd = "loginctl suspend" .. " | i3lock -fi " .. get_wallpaper()
    io.popen(cmd):read("*all")
end
